<%--
  Created by IntelliJ IDEA.
  User: 袁新
  Date: 2018/11/26
  Time: 16:13
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@taglib prefix="mvc" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="fmt" uri="http://www.springframework.org/tags" %>
<!DOCTYPE html>
<html>
<head>
    <title><fmt:message code="doc.th.To-doList"/></title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <link rel="stylesheet" href="/css/officialDocument/officialDocument.css">

    <link rel="stylesheet" href="/lib/layer/skin/default/layer.css">
    <link rel="stylesheet" href="/lib/pagination/style/pagination.css">
    <link rel="stylesheet" href="/css/base.css">
    <link rel="stylesheet" href="/css/base/base.css?20201106.1">
    <link rel="stylesheet" href="/lib/laydate/need/laydate.css">
    <%--<link rel="stylesheet" href="/css/base.css">--%>
    <script src="/js/common/language.js"></script>

    <script type="text/javascript" src="/js/jquery/jquery-1.9.1.js"></script>
    <script src="/js/jquery/jquery.cookie.js"></script>
    <script type="text/javascript" src="/js/base/tablePage.js"></script>
    <script src="/lib/layer/layer.js?20201106"></script>
    <script src="/js/base/base.js"></script>
    <script src="/lib/laydate/laydate.js"></script>
    <script src="/lib/pagination/js/jquery.pagination.min.js" type="text/javascript" charset="utf-8"></script>
    <%--<script src="/js/document/makeADraft.js"></script>--%>
    <link rel="stylesheet" type="text/css" href="/css/commonTheme/${sessionScope.InterfaceModel}/commonTheme.css"/>
    <style type="text/css">
        table{
            table-layout: fixed;
        }
        .pagediv .page-bottom-outer-layer table td:nth-child(3){
            overflow: auto;
            white-space: inherit;
            text-overflow: clip;
        }
        .editAndDelete2 {
            color: #e01919;
        }
        .QueryDelete{
            background: #ef4747;
        }
        /***********11.26待阅文件css样式修改****************/
        .head {
            width: 100%;
            position: fixed;
            top: 0;
            left: 0;
            background: #fff;
            border-bottom: 1px solid #999;
        }
        .headTop{
            top: 45px;
            border-bottom: 0px;
        }
        .head .index_head li span {
            margin-top: 7px;
            margin-left: 20px;
            padding: 6px 14px;
            font-size: 10pt;
        }
        .headli1_2_icon {
            margin-top: -3px!important;
        }
    </style>
</head>
<body>
<div class="head w clearfix">
    <ul class="index_head">
        <li data-num="0">
            <span class="headli1_1" id="waitwork">
                <img class="headli1_2_icon" src="../../img/workflow/work/waitwork.png" alt="" style="margin-top: 0">&nbsp;待阅
            </span>
            <img class="headli1_2" src="../../img/twoth.png" alt="">
        </li>

        <li data-num="1"><span class="headli2_1 endWork one" id="endWork"><img class="headli1_2_icon" src="../../img/workflow/work/endworkchoose.png" alt="" style="margin-top: 0">&nbsp;已阅</span><img src="../../img/twoth.png" alt="" class="headli2_2">
        </li>


    </ul>
</div>
<div class="navigation  clearfix" style="width: 97%; display: block; margin: auto;margin-top: 44px;">
    <div class="left">
        <img src="/img/commonTheme/${sessionScope.InterfaceModel}/daibanfawen.png" alt="">
        <div class="news">已阅</div>
    </div>
    <label class="fl clearfix" style="margin-top: 23px;margin-left: 10px;">
        <span class="fl" style="margin-top: 5px;">发起人：</span>
        <label class="fl"><input name="title" id="beginUser" placeholder="发起人" type="text"></label>
    </label>
    <label class="fl clearfix" style="margin-top: 23px;margin-left: 10px;" >
        <span class="fl" style="margin-top: 5px;"><fmt:message code="notice.th.title"/>：</span>
        <label class="fl"><input name="title" id="title" placeholder="<fmt:message code="global.lang.printsubject"/>"  type="text"></label>
    </label>
    <label class="fl clearfix" style="margin-top: 23px;margin-left: 10px;" >
        <span class="fl" style="margin-top: 5px;"><fmt:message code="global.lang.date"/>：</span>
        <label class="fl"><input name="printDate" id="beginTime" readonly="readonly" placeholder="<fmt:message code="doc.th.enterDate"/>" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})" type="text"></label>

        <button type="button" class="Query fl QuerySearch"><fmt:message code="global.lang.query"/></button>
        <button type="button" class="Query fl QueryDelete" onclick="clickeDelete();"><fmt:message code="global.lang.delete"/></button>
    </label>
</div>

<div id="pagediv">

</div>


<script>
    function cyBtn(e) {
        var runId = e.attr('runid');
        var prcsId = e.attr('prcsId');
        var flowPrcs = e.attr('flowPrcs');
        window.open('/ToBeReadController/ReadFileInfo?&runId='+runId+'&prcsId='+prcsId+'&flowPrcs='+flowPrcs);
    }
    function runWorkListPage() {
        location.reload();
    }

    function clickeDelete() {
        var length = $('.kx[name=checkbox]:checked').length;
        var tid = '';
        for (var i = 0; i < length; i++) {
            var $this = $('.kx[name=checkbox]:checked').eq(i);
            if(i == length-1){
                tid += $this.parents('tr').find('.wenhao1').attr('runId');
            }else{
                tid += $this.parents('tr').find('.wenhao1').attr('runId') + ',';
            }
        }
        if (length == 0) {
            layer.msg('请选择至少一条流程!', {icon: 2});
        } else {
            //删除判断
            layer.confirm('<fmt:message code="sup.th.Delete" />？', {
                btn: ['<fmt:message code="global.lang.ok" />', '<fmt:message code="depatement.th.quxiao" />'] //按钮
            }, function () {
                //确定删除，调接口
                $.ajax({
                    url: '/ToBeReadController/deleteFileIsRead',
                    type: 'get',
                    dataType: 'json',
                    data: {
                        delStr: tid
                    },
                    success: function (obj) {
                        //第三方扩展皮肤
                        layer.msg('<fmt:message code="workflow.th.delsucess" />', {icon: 6});
                        pageObj.init();
                    }
                })
            }, function () {
                layer.closeAll();

            });
        }
    }
    var openRold=parent.opensload;
    var typeName;
    var huiqian;
    $(document).on('click', '#selectAll', function () {
        var ischecked = $(this).attr('ischecked');
        if (ischecked == 'true') {
            $('.kx').prop("checked", "");
            $(this).attr('ischecked', false);
        } else {
            $('.kx').prop("checked", "checked");
            $(this).attr('ischecked', true);
        }
    })

    var pageObj=$.tablePage('#pagediv','1063px',[
        {
            width: '55.6px',
            title: '<input type="checkbox" name="checkbox" ischecked="false" id="selectAll">',
            name: 'prcsId',
            selectFun: function (prcsId, obj) {
                return '<input type="checkbox" name="checkbox" class="kx">';
            }
        },
        {
            width:'85.6px',
            title:'类别',
            name:'sortMainType',
        },
        {
            width:'415.6px',
            title:'<fmt:message code="doc.th.DispatchHeader"/>',
            name:'runName',
            selectFun:function (runName,obj) {
                if(runName!=undefined){
                    if(runName!=''){
                        return '<a href="javascript:;" class="title-banli wenhao wenhao1" onclick="clickRunname($(this))" flowId="'+ obj.flowId +'" runId="'+ obj.runId +'" sortMainType="'+ obj.sortMainType +'" flowStep="'+ obj.prcsId +'" prcsId="'+ obj.flowPrcs +'" runName="'+ obj.runName +'" tableid="'+ obj.tableId +'">'+runName+'</a>'
                    }else{
                        return '<a href="javascript:;" class="title-banli wenhao wenhao1" onclick="clickRunname($(this))" flowId="'+ obj.flowId +'" runId="'+ obj.runId +'" sortMainType="'+ obj.sortMainType +'" flowStep="'+ obj.prcsId +'" prcsId="'+ obj.flowPrcs +'" runName="'+ obj.runName +'" tableid="'+ obj.tableId +'">该流程无标题</a>'
                    }

                }else {
                    return ""
                }
            }
        },
        {
            width:'125.6px',
            title:'发起人',
            name:'userName'
        },{
            width:'180px',
            title:'接收时间',
            name:'createDate',
            selectFun:function (createDate,obj) {
                if(createDate == undefined){
                    return obj.beginTime;
                }else{
                    return createDate;
                }
            }
        },{
            width:'100px',
            title:'操作',
            name:'attachmentId',
            selectFun:function (attachmentId,obj) {
                return '<span onclick="cyBtn($(this))" style="color:#2b7fe0;cursor: pointer;" runId="'+ obj.runId +'" flowPrcs="'+ obj.flowPrcs +'" prcsId="'+ obj.prcsId +'">传阅情况</span>'
            }
        }
    ],function (me) {
        me.data.beginTime=$('#beginTime').val();
        me.data.beginUser=$('#beginUser').val();
        me.data.title=$('#title').val();
        me.data.pageSize=10;

        /***********公文模块智能开发，根据页面url中存在flowId传值判断******************/
        //1显示  // 2不显示  //不写fn这个属性就是全显示
        me.init('/ToBeReadController/ReadFileIsRead?isReadStr=1')
    })




    $('.QuerySearch').click(function () {
        pageObj.data.page=1;
        pageObj.data.beginTime=$('#beginTime').val();
        pageObj.data.beginUser=$('#beginUser').val();
        pageObj.data.title=$('#title').val();
        pageObj.init();
    })
    function clickRunname(e) {
        var flowId = e.attr('flowId');
        var runId = e.attr('runId');
        var sortMainType = e.attr('sortMainType');
        var tabId = e.attr('tableid');
        var prcsId = e.attr('prcsid');
        var flowStep = e.attr('flowstep');
        if(sortMainType == '工作流'){
            window.open('/workflow/work/workformPreView?flowId='+flowId+'&flowStep=&tabId=&tableName=&runId='+runId+'&' +
                'prcsId=&parent=circulate')
        }else{
            window.open('/workflow/work/workformPreView?flowId='+flowId+'&flowStep='+flowStep+'&tabId='+tabId+'&tableName=document&runId='+runId+'&' +
                'prcsId='+prcsId+'&isNomalType=false&hidden=true&parent=circulate&ie_open=yes')
        }

    }

    $(function () {
        $('.index_head li').click(function () {
            var datanums = $(this).attr('data-num');
            $(this).find('span').addClass('one').parent().siblings().find('span').removeClass('one');
            if (datanums == 0) {
                window.location.href = '/ToBeReadController/toReadFile';
            } else if (datanums == 1) {
                window.location.href = '/ToBeReadController/ReadFile';
            }
        })
    })


</script>
</body>
</html>
